/*package com.andyage.interceptor;

import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

public class WebInterceptor extends HandlerInterceptorAdapter{
	@Resource
	//private IWebAdteuserService iadteuserService;
	*//**  
     * 在DispatcherServlet完全处理完请求后被调用,可用于清理资源等   
     *   
     * 当有拦截器抛出异常时,会从当前拦截器往回执行所有的拦截器的afterCompletion()  
     *//*    
	@Override
	public void afterCompletion(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex)
			throws Exception {
		super.afterCompletion(request, response, handler, ex);
	}

	@Override
	public void afterConcurrentHandlingStarted(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		super.afterConcurrentHandlingStarted(request, response, handler);
	}
	*//** 
     * 在业务处理器处理请求执行完成后,生成视图之前执行的动作    
     * 可在modelAndView中加入数据，比如当前时间 
     *//*  
	@Override
	public void postHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler,
			ModelAndView modelAndView) throws Exception {
		super.postHandle(request, response, handler, modelAndView);
	}
	*//**  
     * 在业务处理器处理请求之前被调用  
     * 如果返回false  
     *     从当前的拦截器往回执行所有拦截器的afterCompletion(),再退出拦截器链 
     * 如果返回true  
     *    执行下一个拦截器,直到所有的拦截器都执行完毕  
     *    再执行被拦截的Controller  
     *    然后进入拦截器链,  
     *    从最后一个拦截器往回执行所有的postHandle()  
     *    接着再从最后一个拦截器往回执行所有的afterCompletion()  
     *//*    
	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
		
		
		ResultDescription result = new ResultDescription();
		boolean resultBool = false;
		//这里判定是否处于登录状态
		
		//
		String ticket = request.getParameter("ticket");
		//暂时不考虑session里面的
//		//如果没有ticket参数，可以考虑取session里面的
//		if(ticket == null || ticket.equals(""))
//		{
//			ticket = (String)request.getSession().getAttribute("ticket");	
//		}
        
        //查询数据库这个ticket是否存在，以及过期
        if(ticket!=null && !ticket.equals(""))
        {
        	result = iadteuserService.selectAdteuserIsLogin(ticket);
        	
        }
        else
        {
        	result.setStatus(ResultDescription.UNLOGIN);
        	result.setDescription("没有登录！无ticket！");
        }
        //成功
        if(result.getStatus() == ResultDescription.SUCCESS)
        {
        	resultBool = true;
        	//把查询到的用户信息存放进去
        	request.getSession().setAttribute("AdteuserBean", result.data);
        }
        else
        {
        	String resultJson = result.toJson();
    		PrintWriter out = response.getWriter();
    		out.print(resultJson);
    		out.flush();
    		out.close();
        }
        return resultBool;
	}
}
*/